//
//  BHUserOrderDetailModel.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/8/27.
//

import UIKit

class BHUserOrderDetailModel {
    var orderId: String = ""
    var venueId: String = ""
    var venueName: String = ""
    var title: String = ""
    var orderTime: String = ""
    var payPrice: String = ""
    var operateTime: String = ""
    var photo: String = ""
    var code: String = ""
    var evidence: String = "" // 凭证号
    var address: String = ""
    var payTime: String = ""
    
    
    var status: Int = 0  //订单状态：1-待使用 2-已完成 3-退款/售后
    var payType: Int = 0 // 1支付宝
    var refundStatus: Int = 0 // 退款状态：0-未退款 1-已退款
    var refundFlag: Int = 0 //是否能退款

    func parseDic(_ dic: [String:Any]) {
        self.orderId = BHJsonTool.decodeStringFromDic(dic: dic, key: "id")
        self.venueId = BHJsonTool.decodeStringFromDic(dic: dic, key: "venueId")
        self.venueName = BHJsonTool.decodeStringFromDic(dic: dic, key: "venueName")
        self.title = BHJsonTool.decodeStringFromDic(dic: dic, key: "title")
        self.orderTime = BHJsonTool.decodeStringFromDic(dic: dic, key: "orderTime")
        self.payPrice = BHJsonTool.decodeStringFromDic(dic: dic, key: "payPrice")
        self.operateTime = BHJsonTool.decodeStringFromDic(dic: dic, key: "operateTime")
        self.photo = BHJsonTool.decodeStringFromDic(dic: dic, key: "photo")
        self.code = BHJsonTool.decodeStringFromDic(dic: dic, key: "code")
        self.evidence = BHJsonTool.decodeStringFromDic(dic: dic, key: "evidence")
        self.address = BHJsonTool.decodeStringFromDic(dic: dic, key: "address")
        self.payTime = BHJsonTool.decodeStringFromDic(dic: dic, key: "payTime")

        self.status = BHJsonTool.decodeIntFromDic(dic: dic, key: "photo")
        self.payType = BHJsonTool.decodeIntFromDic(dic: dic, key: "payType")
        self.refundStatus = BHJsonTool.decodeIntFromDic(dic: dic, key: "refundStatus")
        self.refundFlag = BHJsonTool.decodeIntFromDic(dic: dic, key: "refundFlag")
    }
    
    lazy var statuText: String = {
        if self.status == 1 {
            return "待使用"
        }else if self.status == 2 {
            return "已完成"
        }else if self.status == 3 {
            return "退款/售后"
        }else {
            return ""
        }
    }()
    
    
}
